added logic for logged out users