refactor attribute registration logic