moved authenticate function into UI