updated API to allow for call as a module function
small changes