moved main from ts to new driver
added ts state data structure ish