implemented ParseResult
inserted some try/catch blocks
corrected some mistakes