Refactor the cassette IO code into its own namespace