Further optimizations in an attempt to solve #215