Smal optimizations in code if multikey