fixed sorting and added timestamp