Created API and some small fixes