chapter 8 excercises, commonized utility functions