Clean library structure and distance.