Api stub refactoring