clean up error handling; add some error checks; BasicParser works