cleaned up parser