added in api and bunch of other stuff