Not that it really matters, but I originally wrote this. Also, you don't need all the conditional compilation stuff (#defines, #ifdefs and #ifndefs), that was just something I used so I could quickly enable/disable it and find all related code to certain features that I wrote.