further compacted the print year function