mode docs
refactored a little secutiy and authentication