added documentation and made sanitation more clear