renamed a function and added comments