Refactored attributes building. Fixed type hint for ports.