Added a mod function
add function changed slightly
Merge branch 'testing'