Implemented detection of all distinct values and positions of modules for each value