UCJEPS-461: date sorting, other code cleanup