completed code for functions
added comments