added logged in check, other streamlining