Refactored conditional statement + reset variables for each year input