improved the class structure in ajax_thread.js