Sort entries and refactor from() and target()