Move time formatting into seperate function
General improvements