refactored authentication
refactored locking