Remove the unused code I noticed when working on d6e80578 and do some other minor cleanups in the vicinity.