Move all logic for the console app into the library