reorganized methods - gave query its own method