Use if-let to make it safer