Reorganize code for live debug server;