last fixes, compiles now - but untested and unfinished