example 3-8: refactor to private variables