Reworked recipe for getting/setting element attributes