Refactoring console code.
Merge branch 'test' into dev