getAttribute function and other changes