Added errorfile argument