Understanding the solar cycle