BONUS refactor: replace isDefined/apply with Option