Modified factory to work better and page templating