Added comments to all the functions to explain (briefly) what they do