What are the functions of the kidneys?

What are the functions of the kidneys?