Updated time code to be more idiomatic.