refactored algorithms, now implementing a new algorithm is a matter of a one-line script. Also, everything is pretty much working.