impl submapper

refactor submapper and add test case for submapper.