efficiency improvements and fixing a bug when prefix iterating over empty lexica