upgrading to new function-based query