Updated for M3 and new IO library

Also fixed issue #9 and issue #10.