improved Sort