Solving the API encapsulation problem