refactoring API and APIold