working implementation of rendering subpages