Moved the solving of the algorithm to a seperate class that can now be run in threads, used elsewhere and such. There is probably still room to make it more generic. Also changed the README to explain the problem, and the algorithm.