cleaned up extra variables and added comments