-After some debugging, finally a demoable version. fixes included here.