Fix refactoring error and eliminate code block that was silently broken