API refactoring. Part 1.