Refactoring. Replace null with Optional

Sigh.