Made solve run in separate thread so button presses properly, but made thread run with max priority so it is fast.