Drastically improved solver and optimized code.