Further fixes to api and changed writes to use alia.