code cleanup
add support for asynchronous RPC