implement handle function in MachineDoll class.