Full code from demo