Modified the API to be generic