Refactor years method to remove redundant code per planet