impl submapper

refactor submapper and add test case for submapper.
Merge pull request #24 from mackee/submapper

impl submapper