Modifications after @jimCresswell's excellent feedback.