Change API and handle errors (node style).