Minor restructuring and commenting