end of day logic cleaned up