Fixing/breaking tests and refactoring.