Fix K+R reverse optimization NPE
Introduce maxPreTransitDistance parameter
Fix whitespace
fixes #1419 with last xhr check and request delay