Simplify implementation for #459.