Compatibility with .Net 4.0 on Wiondows requires using the newer hosting
APIs
Replaced windows hard coded runtime version with binding to latest version
Moved around some functions to the intended context within the file