Added ORDER BY NULL optimisation, fixing unit tests