Authentication logic added