Misc code fixes
Remove some dead code