Replace time.Sleep with a time.Ticker (fixes #1)