v3.4: fixed null pointer error in Algorithms, other efficiency upgrades to algorithms