this would look much better with Q.defer