Refactoring/optimizing SpecialUnconnectedPages

Some basic refactoring. Dropping unneeded code. Moving unused
variables into their scope.

Change-Id: I99273c175d3742ae72169d5c0c934a122f6832f3