Added protection for unlogged-in users