Added AutoPlugin, heavy refactoring