Simple object recognition code