SML code for Coursera classes