creating custom promise objects using $q