Refactor view templates and user profile page