feature #2435: Remove unused function. Minor optimizations