Cleaning of the code.
New structure using policy class and a complexity of O(n) instead of O(n*m) before.