Understanding the electronic properties of molecule/metal junctions: the case study of thiols on gold