Switched to  for the API request and minor code cleanup