initial version from tools/v2