Added code to prevent DB timeouts