Some code cleanups