Many fixes to get the API into a stable state.