added wrap fetching into transaction, added indexes