Noam's version of IMHA.cpp, which is nicer for testing