Fixes #57 Also implemented better error handling for parse errors