#9 extracted code