macro refactor rest