Huge refactor

try to split the command-line specific stuff into this repo