Refactored API for select queries.