Refactor. Creating queries.