function setTrap added