command-classes: refactoring and fixed bugs