code cleaned, cmd handlers added