A variety of cleanups to get it actually working