solved some bugs and reached aed an acceptable behaviour with portals