Modified thread_controller.php