modified and refined codes in Macros project.