Renamed some variables and added some comments
Added test for initial index creation