added signal handler for cleanup