Refactored some test code and hep-ce util header.