Refactoring / improvements