"आहारशुद्धौ सत्त्वशुद्धिः सत्त्वशुद्धौ ध्रुवा स्मृतिः |

स्मृतिलभते ज्ञानम् ज्ञानाद् धर्मः संजायते ||"

When the food is pure, the mind becomes pure. When the mind is pure, memory becomes steady.
From steady memory, knowledge is obtained, and from knowledge, one's actions become righteous.