End of day handler. Minor improvements