Why did John Calvin write the Institutes of the Christian Religion?

to refute the teachings of Martin Luther
to defend a king’s right to an annulment
to support the practices of the Catholic Church
to explain the Reformation and Protestant beliefs