Reduce differences to master and tidy up mingw additions a little (not tested)