Added refactoring and added image and link attributes for macro