Uses less side-effects and handle errors.