Developed the body of the functions and added more comments

Developed the body of the functions and added more comments