Extracted time management to own class
Using new time, fixed errors