Updated and working code from http://vimeo.com/7900532#