Changed to calculate localtime rather than hard code it