added CommandController + some refactoring