First pass at API implementation.