changed name of functions and added comments