Added signal trapping