refactor runtime api