restructured plugin to make everything cleaner.