working version with emptyKey support and table load limiting