added range validation