added type to sql
dropped old function
split off query function
dropped queries object
intermediate filter