replaced poor promise with applicative monad