Refactor parser to use vectors