Refactoring classes from Tobias