added sorting by beginning time