refactoring to get q promise more involved