Code to accompany http://emberlamps.com/?p=26