change ms query to support custom order and other features