changed demo code slightly