Move potentialPortalLevel to main for common usage