added support for logged in and logged out users