More tweaks and removed dead code.