Some sample code, maybe with some explaination:
Some other code smaple, maybe with some explaination: