added checks to see if a endpoints are valid