reworked to use ports for inter-layer communication