Refactor tests to have an explicit object scope