made api call module a little dryer