added range validation and key matcher