Authenticating
refactoring authentication script