Nearly a complete remake of the software to be computationally efficient. Will try to add the old code (which is more general and easy to read) in another branch.