Some improvements, hopefully

I'm afraid I'm pretty inexperienced with Haskell (like, I don't know how to get cabal set up to get all these dependencies), so I wasn't able to confirm that these changes actually work, but hopefully they're not too far off the mark.