re-added mod function