Improved data structure for FaceBased algorithm + refactoring.