reimplented original auth