Refactored some more code into the toneAnalaysis library