Used new method name in sample code.

'before' gives a runtime warning about being deprecated.