More cleanup done and more bugs fixed.