Here is my code sample I put together for my XTERN application.