initial work on generalising rpc generation