Tried to clean up functions dealing with interpretation and IO, but it's
still pretty messy. But I think I got rid of some bugs, judging by how
wrong some of the old code looked.

There is still some work to be done with the helper function of interpretation_io.