Tear down refactored to a separate function