add calculations to parser and refactor