Thread cleanup, everything works except threads. Compiler issues.