Refactoring complex example.