reverted to working but inefficient way of loading pages.