More restructuring and commenting