Using generic api with pre functions