changed output function name to apiOut to avoid a naming conflict