working version for logged in users only