cleaned control plugin code