code cleaning and min version