pick the right function