refactored signal handlers