added basic code for capturing of traps.