parser refactored & tests updated