Added code that correctly deals with hours >= 24