Updating API file and added more sanity checks