Added body of functions and comments