redesigned function findobject