added comments and console logs to make issues clearer to address
cleanup