Used new method name in sample code.

'before' gives a runtime warning about being deprecated.
Merge pull request #712 from aramk/patch-1

Used new method name in sample code.