Merged all code into header. Removed tglib.cpp