refactor maptype testing codes