updated self-contained example