added logout logic and saving current user location to session and db