improve solarization algorithm