details on demo 2's code