Rewriting functions for each page (see commented code)