Exercise6 modified