Refactor of command parsing
Improve command handling