Insert extracted method after its previous surrounding method

Fixes #1001808