Here's some sample code.