cleaning queries and refactoring names