extract apis for more flexibility