recoded whole plugin