Hi @han,
Take a look at the following thread for sample code and how to avoid some common pitfalls with that: