Random Cleanup

Cleanup and simplification of some code.