example 4 and 5 (pre-extra credit)