Moved updatePage function to separate file