worked on error handling for parsing