populate_time function added