code clean up and initial comments