Redo parser and update to fix bugs