Improve code by using a buffer in the parser