Added rpc. Added different run modes.