Big refactoring in API: start to implement new structure.