Added commenting and fixes. Added more safety to dataset generator.