refactor to be more lib-like, remove command-line