refactored init to use promises