Refactor attributes and attribute structure to be more flexible