Added Anton's code from the demo