merge conflict for for merging branch. removed some unused variables and corrected some parts of the algorithm , initialized the variable nextMaxRssiIndex to zero, so that there is no unwanted behaviour