Added sortByTime()

And some other minor changes