Better solution for strict key check