cleaned up the parser a bit