Code for Leach and Mason (2021)