I added the changes Darrel suggested and it all works fine.
I need to make small changes to the code to better fit my application and i will post it tomorrow.

Thanks again and good night!

Nick