Started biiiig refactoring of plugin