refactor runtime and promises