Refactor element wrapping