updated code to compile under windows visual studios 10