Using macro for repeated code