cleanup, unit test, and add voice crossing check