Enhanced the img() function