Refactor with macros and shared example
Add comments