BS-6723 + BS-8455
Improve groovy refactoring
Do not add dependencies for new declared variables