optimize fetch days function