Cleaned up parser code