some cleaning and commenting