Tidied up main2 and wrote basic IO example.
Tidied up repository.