Plugins code refactory