use of ternary operator instead of single line if-else
cleaned up command class
refactoring plus specs