refactor monitor<->app rpc layer