createBuffer API refactored.