various code cleanups