Using more idiomatic if-let rather than let followed by when-not.