Hi,
Maybe this code sample here will help. You should pay attention to the notes in the article, as it is written for a very early version of 6.4 so it is not for certain that it will work directly for current version. Starting from scratch is probably your best option. The article should explain what needs to be done and you can look at the modified changes to take a look how it should be done.
Hope this helps,
Palli