major api refactoring