is even easier to implement than the version in Appendix A