Trim cmd, remove redundant as_slice() calls.
First attempt at parsing commands via regex.