internal refactoring for support multiple backends 1/3