Code cleaning and plugin system improvment