added back updated mod function