Added input validation for hours field