Revamped api - much tidying of flow