refactoring for api v1