move cmd checks to cmd handler