More on the api and factory generator - in progress.