moved signal handler registration and cleaned up unused