Using q promise for api instead of callbacks