Fix appending of name attribute.
Changed a few things