moved auth functions to auth module