Introduce Command layer and refactoring

Closed #9