Refactored to help the tests