better cmd handling + QUIT cmd