added ref condtion