making ch 4 and ch 5 code consistent