Updated example and fixed calls to depreciated functions.