mod function added