added comments & some cleanup