updated db connection and pagination handlers