Integrated TSS with storage of thread data; cleaned up the heap allocation functions to throw bad_alloc if they run out of memory