refactored by pulling up common elements of all api's into an api class