Added code for user authentication