revert some scoping code for refactoring and remove useless if statement