General cleanup/Fix WIN32 error/Make thread ready