Refactoring because some tests were failing