Moved a few things to the api file