Refine code to use macro instead of fixed value