Wrote looping code as well as better averaging. Now displays in ms