added data-request-redirect="true"
Organized the code
If no session, the set it to null so it won't break the layout.