refactor get_arrival_times method with collect and compact