Final version with macro