Update output to use wait/notify
Migrate I/O to separate classes