refactoring end of day