working plugin. still some small problems