simplified instance selection logic,
refactored instance revert logic.