Added users and basic auth. Refactor.
Merge remote-tracking branch 'origin/master'