Migrate IsWithin to use generics properly (despite its fancy builder)