Added abstraction code to talk to real or simulated I/O