Feature/new api update

Rewritten to match API changes.