refactor

rewrite the loop used for get styles tag.