Minor refactoring changes for default page redirect loop fix