some improvements to main logic and rpc modules. still unusable!