cmd handling redesigned