Updated setAttribute() method