Assorted cleanups

Silence sensible Eclipse warnings, and fix some bugs found during the process.