Changed the way new ids are generated. Added more tests to ensure all indexes are created properly