Sort arrival times in actual function, not just the test function