Updated code to fix port issues.