refactoring for better api separation