API: some refactoring