Fix formatting the style attribute
Refactor for faster array iteration