Minor cleanups and scalability improvements.