Sam's code.
Merge pull request #1 from sjudson/master

Sam's code.