Smarter command string logic; machine handler