each call to ```expand_path``` results in a network round trip.  It would be better to call it once, store it in a var and do your checks on that.