Done. Needs only more testing, refactoring, modulo and multiplication.