Moved time-related logic to util. Misc. improvements in repl.