misc code cleanups