Cleaned up the error reporting and added line numbers