Add signal trapping code