many code adjustments