Made the example more pythonic.