Some refactoring of the API..