updated and improved to the api