prev function added