use macros and adjust snprintf call