code clean up; nicer solution to solve the public link share problem if a user is logged in