refactor attribute checks