Code for married people: An elaborate drill for defecation is prescribed in the most respected Aryan scripture - "Manusmriti Vishnupuran."

* Before going to the toilet the scripture prescribes elaborate drill.

* Before going for defecation one was to chant the following mantra from Narad Puran :- "Gachhantu Rishio Deva Pishacha ye cha grihya ka Pitrbhutagana surve Karishye Malamochanam"
* Before going for defecation it was prescribed that the sacred thread should be rolled to a smaller size and be put on the right ear.
* The head was to be covered with a cloth. In the absence of cloth, the sacred thread was to be brought over the head and was to be hung on the left ear.
* Then while observing silence and facing north in the day and south in the night one could defecate.
* While defecating one was not to touch water.
* After defecation the water pot was to be held in the right hand, left hand was to be used for cleaning.

Ablution code: In Vishnu Purana some rules are laid down for post defecation stage.

It says, while defecating the orientation of the face should not be towards "Sun", "Brahmin", "Fire", or "Moon".

* After defecation the "Linga" (generative organ) is to be washed once, "Guda" (anus) to be washed three times, the left hand to be washed ten times, and the right hand seven times, and both the feet to be cleaned with earth and water three times.
* After defecation the water pot was to be held in the right hand and was to be used for cleaning.
* The "Linga" was to be rubbed once with earth and the "Guda" rubbed three times with earth. Then both washed with water. This was to ensure that there is no odour left in the body.
* After this one should pick up water with right hand. One was advised to pick-up fist full of earth. This was to be divided in three parts. With the first part it was laid down that the left hand be cleaned 10 times and the right was to be cleaned with the second part 7 times. The third part was to be used to clean three times the water utensil.
* It was also laid down that both the feet were to be washed with water.

The following shloka gives the philosophy of protecting environment by adoption of elaborate defecation practices,

* Urination ought to be done at least at a distance of 10 cubits from the source of water. Defecation to be done at a distance of 100 cubits from the source of water.
* At least 40 cubits distance is to be observed while urinating near a river or a temple and defecation at least at a distance of 400 cubits.
* Urination and defecation ought not to be done in running water or river. Water should be taken in hand and washed away from the river.

For different classes: Manusmriti has also laid specific rules for the specific section of the society, it says:

For those who observe celibacy or have renounced the world should observe the rules differently.

* Those observing celibacy should observe the rule twice more intensely than the married ones.
* Those who are in "Vanaprastha" should observe three times more intensely.
* The saints should observe the rules four times more intensely than the married ones.

The above means that all the above rules are for urination and defecation in the day time. In the night the frequency of wash etc. is reduced by half. If one is travelling the rules are further reduced by half. If one is sick, the rules need to be observed as per capacity.