code cleanup and final checkin