refactored parser + fixes