Made sorting based on time