Added comments in file to document the functions