Added processing loop and signal handler