[IMP] set wrapper of API + refactor code