Major rework with simplified API.