More cleanup and polishing of the code