Refactoring and clarifications