Implement new insert API
Refactoring