Update API, almost full rewrite since @ekarlso found fundamental problems with the old model