removed printfs and replaced some with PLUGIN_TRACE