first pass, wip, warning - dirty code! :-)