starting to switch to the new api layer

CURRENTLY BROKEN! FIX PENDING.