moved functionality to package and modified plugin to use the package