Refactored to split queries from sites