Converted for browser use.

Fixes multiple bugs that caused wrong results in basic operations,
Adds modulo operation,
Usable in browser as it is