Cleaned up code for auto detection, still needs testing with an actual windows computer