sql query fixes, changed filter/sort program