added test and refactored parser