added reco_endpoint and removed unnecesary if statements