Added promise utilities: safePromise, resolve, and reject.