Full cleanup + dead reference removal