Moved date parsing to sub