Cleans up code. Closes #2.