Copy code from SDK demo