Moved where timeEnd is set