Changed a bunch of stuff, seperated the API