what is the purpose of having periods