Much simpler implementation of jquery findSafe