Refactored signal.c/signal.rb