refactor of result types for query