Tweaked timer to work with nanoseconds