Creates ad.idx and is able to transverse through the database