Two functions I need in setdefaults and search a few times

If this is not the right place for general functions please tell me where to put them!