major refactoring and decentralisation