Some speedups and fixes are inspired by concepts from SettingDust's Lazyyyyy (Apache 2.0), but the Java code is written entirely from scratch!!