Added comments and details about each function