improve code insertion in two ways: