modify find function to a more universal one