Credit where credit is due, this is based on Paul's work.