refactor attributes method