Major rearchitecting to use jsonrpc and client-server model