add Authkey setter/getter
Simplify function