handle nested commands