Exercise7 modified