clean up
renamed several functions
rewritten so parser can decline input using