Add macro and refactor tests