Added timeout to query statements