Added code & comments

Modelled after Roger Peng's examples.