Code for the lightwand project