First version.
Uses query if available.