code refactor && add high level api