Windows related changes and cosmetics 

Hi, 

I've added `QueryPerformanceCounter` to support timer related features on Windows. Also various cosmetics and fixes in the code. 

Best Regards,
Kacper