This code was originaly created by Ferenc Kahlesz. I have made changes for it to work with visual studio 12 ...etc