modified exercise 9 to implement via prototype