Fix some warnings, minor code cleanup.