First working version with RPC