Improoved the api