Refactored for #90.