Updated to support traps.