Simplfying logic in prepareAttr