Code copy/pasted, derived, or inspired by "Practical Probabilistic Programming" (Manning)