Refactoring error fixed (variable names remained unchanged, but code was moved to different context).