Finished the parser. Refactored it into functions.