added code for authentication