second wave of parse latex refinements
cleaned up code + added comments