[Yujun] Use Optional to replace Element where could be null.
[Yujun] Use Optional to replace Element where could be null.