updating API to be more JS-ish