Fixed ex5.4. Now works as described.