Small performance modifications including compacting JPS code trading
conditional logic for pure mathematics which also shrunk the code.