Improved state_change_natoms and used it more