Added A helper for filtering and sorting and ammendedtests to use it