updated for multi sorting