add TimeMeasurement class and some simple fixes