refactored as a library with an api. will still be able to function
via cli as well, once that part is uncommented and merged