added type to query function, for lambdas