Cleaned up port code