Refactor

Quite a big refactor to decouple a lot of the code from Console/Application and Console/Command/TestCommand.