Code cleanup
Renamed cmd to shell to avoid conflict with built-in module