more code cleanups, two patches left to clean up