refactor(core): better use of promises