Better version of command interpreting, but some code is in ugly places.