some debug messages;
also, build a proper jsonrpc response object