Risk of recession looms but middle market more optimistic for 2024