Code after some more refactoring