Updated extend() method