It works! But now I have stack issues :(
finished algorithm, can't test it due to Stack Level being too deep