Added code for authentication