converted most stuff to use the api class