refactor plugin class and adding logging