This has a good(!) early write-up by AK about some of the mathematical steps in deriving the system of equations.