using Q node module to implement JS promises; promises are used to keep logic synchronized amongst many asynchronous database calls