Refactoring internal API