Comments added to explain functions inputs and outputs