rewrote attr handling