what about $exists or $isfile and you can replace == $null by adding "!" before the identifer
and remove the "()" around the condition it will make the code slower