refactoring: element and attr constructors