Using q, but can't resolve variable, has to find a way to pass it along
with the promise