Update dictFunc.java

Large efficiency improvements and some fixes.