order attributes with primary first