implemented significant speedup of solver