big breakthrough in math
nearly done, need to reorganize code though
works, now I just need to split main from the class and add docs