refactored commands and created unit tests