major refactoring and plugin system done