Cleaned up comments, tidied up old code, switched cmd() over to
use --param=value format, so that returning a tuple works.