now it works! (rewrote quite a big part of it...)