remove unnecessary triming
clean up, condense, add comments