Refactor basic API.