Re-structuring to handle sub-commands