Added calculation of tone number