Simplification suggested by @mgedmin