Refactoring and general organisation