PortalKit: refactor fw