Logic updated

Logic Updated