tested and finished example 2