refactor some of the async stuff. better use of promises and Q