Better implementation of Parser.