[major] refactoring adding promise and improving API