Saving of pages is now separated into a function