Moved q out
Fix for creating a promise