Separate query and configuration logic from Session.