CLEAN UP AND COMMENT CODE