added stopwatch to measure performance