Added averaging of TDS values in commands.cpp