Some peaces of code,... my own understanding might help you..