Refactor instanceof test pack