Made change to the 1 year gap check, refactored some code