Improved tone detection, with new template