Changed to timer for increased accuracy.