A somewhat better design added (issue #3)