use funnction to replace macro