fixed logic bug, added margin-based appraoch to select examples