Get rid of unused SQL query