Portals

Committing some fixes to the portal generation algol.