added timestamp field and implemented sorting