Source code refactoring. Extracted common functionality into merged methods

Source code refactoring. Extracted common functionality into merged methods
This change doesn't improve the code. There are 3 symbols (a function name, a variable name and a string literal) both before and after the change.