working version without portals