some cleaning/formatting and commenting