Turned updateTime into a function and other stuff