More dead code removal and code re-organisation