move time management into separate file