Cleanup port code