Fixing broken tests because of merge.
Some refactoring.