added printlines to buildIndex