Remove unused variable
Refactor function names
Add handling of unknown commands