Refactored tests as per listing 5.27