Code from Lecture 4 in class demo for CS193p Winter 2013 Stanford