Patch 1

Some code cleanups.