Move bio and page generation into recursive function