Refactored code to incorporate physical/data/transport/app layers.