Various other code cleanups