Merged in rpc stuff, fixed few bugs