refactoring and generalisation changes