Refactored commands
Refactored error handling