moving logic out of the console and down into the library
moved more down into the core
some refactoring