Clean up a lot of code.

- Use the fact that you can group strings in parens to join them.
- Remove unused variables.
- Simplify some functions.