cleaned up parser code