some more code cleanups before merge