Tests fixed with major refactor