Moved the thread-function to a new file. Furthermore enough threads for textured stuff are there, but not used yet.