Adding functions to this file as instructed
Added extra comments