authenticate logic added
merged with Zifei