this is an oportunistic parser, so dont complain
better error messages
remove duplicate code