added port io functionality and example code