Cleaned up the code.

This should address the rest of #335.
I don't know. Why would it not be needed?