move cache and respond function in their own modules.