restructure things to act as a lib w/ a cmd