Refactor ObjectElement class