Moved main loop logic from proxy_main() to main().
Added ipc_* functions.