Minor code cleanups. Still a mess.