complete minimal working example, not thoroughly tested