Refactoring api/ package.