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