Added simple main loop with signal handlers