Fixes seg fault with new user page.
Refactor loops and templates so less code is needed.