Minor refactoring to avoid double-return.
Remove dead code.
Remove dead code.
Collapse redundant nested if.
Removed dead lines.