refactored leap year exercise