Added dynamic width image attributes
Seperate the two core functions