Changed date function in functions file