HW2-3: making the changes to handle session and redirects