Refactoring QueryExecution class and specs