coded most of the outputplugin