fixed casting issue with timestamp, also made timing more accurate. Each cycle is off by avg. of 75us (before it was more like 600-1000us)