Refactoring & adding switch command