refactor for public release