Making some small cleanups and bug fixes.