cleaning up pitch detection