Updated same to use the right method appendAttr()