Refactored lots of code for handling pages showing private content