Restructure command parsing